www.gusucode.com > 落叶冰点万能企业网站内容管理系统 V9.1 > 落叶冰点万能企业网站内容管理系统 V9.1\code\Label\custom_Label\公用函数include及论坛博客等标签库\nd_search_jilu.asp
<%'$start_ext_newDsoft 以下系统生成,勿删! '$newDsoft_label_type$:asp_label$end_newDsoft_label_type$ '$newDsoft_label_name$:nd_search_jilu$end_newDsoft_label_name$ '$newDsoft_label_sql$: $end_newDsoft_label_sql$ '$newDsoft_label_params$:ctype,内容type,文章填article,下载填down,外面不用加引号,2|key,搜索关键词,1|sys_content_type,频道id,1$end_newDsoft_label_params$ '$newDsoft_label_fenye_num$: $end_newDsoft_label_fenye_num$ '$newDsoft_label_beizhu$:记录搜索关键词$end_newDsoft_label_beizhu$ '$newDsoft_is_sys_label$:0$end_newDsoft_is_sys_label$ '$newDsoft_other_params$:htmledxa:3|htmledxb:$end_newDsoft_other_params$ '$end_ext_newDsoft%> <% '以下勿删,防止生成htm后ajax调本标签时中文url乱码 session.CodePage=936 Private Function getIP() If Request.ServerVariables("HTTP_X_FORWARDED_FOR") = "" Or InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), "unknown") > 0 Then strIPAddr = Request.ServerVariables("REMOTE_ADDR") ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",") > 0 Then strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",")-1) Actforip = Request.ServerVariables("REMOTE_ADDR") ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";") > 0 Then strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";")-1) Actforip = Request.ServerVariables("REMOTE_ADDR") Else strIPAddr = Request.ServerVariables("HTTP_X_FORWARDED_FOR") Actforip = Request.ServerVariables("REMOTE_ADDR") End If getIP = Replace(Trim(Mid(strIPAddr, 1, 30)), "'", "") End Function dir_set="..\" nd_cc_chae_mdb="data\pdta\##%20%35cc_cace###.asa" 'On Error Resume Next 'Dim ConnStr ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(dir_set&nd_cc_chae_mdb) Set conn2 = Server.CreateObject("ADODB.Connection") conn2.open ConnStr If Err Then Err.Clear Set conn2 = Nothing Response.Write "数据库连接出错,请检查Conn.asp文件中的数据库参数设置。" Response.End End If set rs44g21=server.CreateObject("adodb.recordset") rs44g21.open "select top 1 * from reset_time",conn2,1,3 if not rs44g21.eof then dddtt=rs44g21("search_reset_time_jilu") if cstr(dddtt&"")="" or isdate(dddtt)<>true then rs44g21("search_reset_time_jilu")=now() rs44g21("searchsave_reset_time_jilu")=now() rs44g21.update else set rs44g2111=server.CreateObject("adodb.recordset") rs44g2111.open "select count(*) from keys_save",conn2,1,1 kkkynum=rs44g2111(0) '大于2000条则开始清理 if kkkynum>2000 then '-------- ssslstk=0 set rs44g211=server.CreateObject("adodb.recordset") rs44g211.open "select top 200 * from keys_save order by clng(key_search_times) desc",conn2,1,1 if not rs44g211.eof then do while not rs44g211.eof ssslstk=rs44g211("key_search_times") rs44g211.movenext loop end if '-------- conn2.execute("delete from keys_save where key_search_times<="&cstr(ssslstk)) conn2.execute("update keys_save set key_search_times=key_search_times-"&cstr(ssslstk)) conn2.execute("update keys_save set key_search_times=0 where key_search_times<0") rs44g21("search_reset_time_jilu")=now() rs44g21.update end if end if else rs44g21.addnew rs44g21("dings_reset_time_jilu")=now() rs44g21("search_reset_time_jilu")=now() rs44g21("searchsave_reset_time_jilu")=now() rs44g21.update end if %><% if cstr(request("nntserhjilu")&"")<>"1" then Function URLDecode(enStr) dim deStr dim c,i,v deStr="" for i=1 to len(enStr) c=Mid(enStr,i,1) if c="%" then v=eval("&h"+Mid(enStr,i+1,2)) if v<128 then deStr=deStr&chr(v) i=i+2 else if isvalidhex(mid(enstr,i,3)) then if isvalidhex(mid(enstr,i+3,3)) then v=eval("&h"+Mid(enStr,i+1,2)+Mid(enStr,i+4,2)) deStr=deStr&chr(v) i=i+5 else v=eval("&h"+Mid(enStr,i+1,2)+cstr(hex(asc(Mid(enStr,i+3,1))))) deStr=deStr&chr(v) i=i+3 end if else destr=destr&c end if end if else if c="+" then deStr=deStr&" " else deStr=deStr&c end if end if next URLDecode=deStr end function function isvalidhex(str) isvalidhex=true str=ucase(str) if len(str)<>3 then isvalidhex=false:exit function if left(str,1)<>"%" then isvalidhex=false:exit function c=mid(str,2,1) if not (((c>="0") and (c<="9")) or ((c>="A") and (c<="Z"))) then isvalidhex=false:exit function c=mid(str,3,1) if not (((c>="0") and (c<="9")) or ((c>="A") and (c<="Z"))) then isvalidhex=false:exit function end function cctyp="$xxvar$ctype" keyy=lcase(trim($xxvar$key)) sys_content_type=$xxvar$sys_content_type set rs44g21=server.CreateObject("adodb.recordset") rs44g21.open "select top 1 * from reset_time",conn2,1,3 if not rs44g21.eof then dddtt=rs44g21("searchsave_reset_time_jilu") if cstr(dddtt&"")="" or isdate(dddtt)<>true then rs44g21("searchsave_reset_time_jilu")=now() rs44g21.update else if day(dddtt)<>day(now()) then conn2.execute("delete from keysearchs_save") rs44g21("searchsave_reset_time_jilu")=now() rs44g21.update end if end if else rs44g21.addnew rs44g21("searchsave_reset_time_jilu")=now() rs44g21("search_reset_time_jilu")=now() rs44g21.update end if set rs44g2=server.CreateObject("adodb.recordset") rs44g2.open "select * from keysearchs_save where search_ren_ip='"&getIP()&"' and search_content_type='"&cctyp&"' and search_content_key='"&keyy&"' and sys_content_type='"&sys_content_type&"'",conn2,1,3 if not rs44g2.eof then okdod=3 else rs44g2.addnew rs44g2("search_ren_ip")=getIP() rs44g2("search_content_type")=cctyp rs44g2("search_content_key")=keyy rs44g2("search_time")=now() rs44g2("sys_content_type")=sys_content_type rs44g2.update() '----- if len(cstr(keyy&""))<30 then set rs44g22=server.CreateObject("adodb.recordset") rs44g22.open "select * from keys_save where keywords='"&keyy&"' and search_content_type='"&cctyp&"'",conn2,1,3 if not rs44g22.eof then rs44g22("key_search_times")=rs44g22("key_search_times")+1 rs44g22.update() else rs44g22.addnew rs44g22("keywords")=keyy rs44g22("key_search_times")=1 rs44g22("search_content_type")=cctyp rs44g22("sys_content_type")=sys_content_type rs44g22.update() end if end if end if end if %>